import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/chauffeur/list',
    method: 'get',
    params: query
  })
}

export function getTotal(data) {
  return request({
    url: '/chauffeur/query/online',
    method: 'get',
    data
  })
}

export function searchList(data) {
  console.log(data)
  return request({
    url: '/chauffeur/search',
    method: 'get',
    params: data
  })
}

export function stopCar(id) {
  console.log(id)
  return request({
    url: '/chauffeur/stop/' + id,
    method: 'put',
    params: { id }
  })
}
export function backCar(id) {
  console.log(id)
  return request({
    url: '/chauffeur/back/' + id,
    method: 'put',
    params: { id }
  })
}
export function getDriverDetail(id) {
  console.log(id)
  return request({
    url: '/chauffeur/details/' + id,
    method: 'get'
  })
}
export function getDriverOrderList(id) {
  console.log(id)
  return request({
    url: '/chauffeur/order/list/' + id,
    method: 'get'
  })
}
export function createObjectURL(data) {
  return request({
    url: '/file/img/upload/',
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data'
    },
    data: data
  })
}
export function updateArticle(data) {
  return request({
    url: '/chauffeur/edit',
    method: 'put',
    headers: {
      'Content-Type': 'application/json'
    },
    data: data
  })
}
export function fetchCommentList(data) {
  return request({
    url: '/comment/list',
    method: 'get',
    params: data
  })
}
export function getCommentTotal(data) {
  return request({
    url: '/comment/total',
    method: 'get',
    params: data
  })
}
export function addPic(data) {
  return request({
    url: '/chauffeur/save/approve/info',
    method: 'POST',
    data: data
  })
}
export function createArticle(data) {
  return request({
    url: '/owner/add/chauffeur',
    method: 'POST',
    data: data
  })
}
export function commentSearch(data) {
  return request({
    url: '/comment/search',
    method: 'get',
    params: data
  })
}
